//
//  UIView+Extension.swift
//  weibo
//
//  Created by Limonwei on 15/12/12.
//  Copyright © 2015年 heima. All rights reserved.
//

//抽象UIView的frame

import UIKit

//x值 y值 宽高 size
extension UIView {
    
    var x: CGFloat {
        
        get{
            return frame.origin.x
        }
        set{
            var frame = self.frame
            frame.origin.x = newValue
            self.frame = frame
        }
    }
    
    var y: CGFloat {
        
        get{
            return frame.origin.y
        }
        set{
            var frame = self.frame
            frame.origin.y = newValue
            self.frame = frame
        }
    }

    var width: CGFloat {
        
        get{
            return frame.size.width
        }
        set{
            var frame = self.frame
            frame.size.width = newValue
            self.frame = frame
        }
    }

    var height: CGFloat {
        
        get{
            return frame.size.height
        }
        set{
            var frame = self.frame
            frame.size.height = newValue
            self.frame = frame
        }
    }
    
    var size: CGSize {
        
        get{
            return frame.size
        }
        set{
            var frame = self.frame
            frame.size = newValue
            self.frame = frame
        }
    }


}































